<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/jquery-3.5.1.js"></script>
<script type="text/javascript">
	function submit(){
		
		$.ajax({
			url:"${pageContext.request.contextPath}/insertUser",
			type:"post",
			data:{
				"username":$("#u").val(),
				"password":$("#pa").val(),
				"permissions":$("#pe").val()
			},
			success:function (asdf){
				if(asdf>0){
					alert("插进去了");
					window.location.href="${pageContext.request.contextPath}/page5";
				}else{
					alert("插不进去");
					window.location.href="${pageContext.request.contextPath}/error/error";
				}
			}
		});
	}
</script>
<body>
	用户名：<input type="text" name="username" id="u" required="required" placeholder="请输入用户名"><br>
	密码：<input type="text" name="password" id="pa" required="required" placeholder="请输入密码"><br>
	权限：<input type="text" name="permissions" id="pe" required="required" placeholder="请输入权限"><br>
	<button type="button" onclick="submit()">添加用户</button>
</body>
</html>